/**********************************************************************************
 * Copyright (c) 2012 - 2012,  ObjectPoolLite, All right reserved
 * Title: com.adc.litepool.base  BaseObjectPoolHandler.java 
 * @author shen  shenqiao2012@163.com 
 *  2012-7-31 下午1:54:34 
 *********************************************************************************/


package com.adc.litepool.base;

import com.adc.litepool.ObjectPoolHandler;
import com.adc.litepool.PoolableObjectFactory;



public class BaseObjectPoolHandler implements ObjectPoolHandler {
	  /** 对象池是否已经关闭 */  
    private volatile boolean closed = false;  

	/**
	 * Description:  
	 * @see com.adc.litepool.ObjectPoolHandler#borrowObject() 
	 */
	@Override
	public Object borrowObject() {
		// TODO Auto-generated method stub
		return null;
	}

	/**
	 * Description:  
	 * @see com.adc.litepool.ObjectPoolHandler#returnObject(java.lang.Object) 
	 */
	@Override
	public void returnObject(Object obj) {
		// TODO Auto-generated method stub

	}

	/**
	 * Description:  
	 * @see com.adc.litepool.ObjectPoolHandler#getMaxNum() 
	 */
	@Override
	public int getMaxNum() {
		return -1;
	}

	/**
	 * Description:  
	 * @see com.adc.litepool.ObjectPoolHandler#getActiveNum() 
	 */
	@Override
	public int getActiveNum() {
		return -1;
	}

	/**
	 * Description:  
	 * @see com.adc.litepool.ObjectPoolHandler#getIdleNum() 
	 */
	@Override
	public int getIdleNum() {
		return -1;
	}

	/**
	 * Description:  
	 * @see com.adc.litepool.ObjectPoolHandler#clear() 
	 */
	@Override
	public void clear() {

	}

	/**
	 * Description:  
	 * @see com.adc.litepool.ObjectPoolHandler#close() 
	 */
	@Override
	public void close() {
		closed=true;
	}

	/**
	 * Description:  
	 * @see com.adc.litepool.ObjectPoolHandler#setPoolableObjectFactory(com.adc.litepool.PoolableObjectFactory) 
	 */
	@Override
	public void setPoolableObjectFactory(PoolableObjectFactory factory) {
		// TODO Auto-generated method stub
		
	}

	/** 
     * 返回对象池是否关闭 
     *  
     * @return 对象池关闭状态 
     */ 
	protected final boolean isClosed() {
		return closed;
	}

	/** 
     * 断言对象池是否处于开放状态 
     *  
     * @throws IllegalStateException 
     */  
	protected final void assertOpen() {
		if (isClosed()) {
			throw new IllegalStateException("[对象池已关闭状态！无法进行相应操作！]");  
		}
	}

}
